<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:composition template="/view/templates/layout.xhtml">
        <ui:define name="title">Arritimia</ui:define>
        <ui:define name="menu">
            <ui:include src="/view/templates/adm-menu.xhtml"/>
        </ui:define>
        <ui:define name="toolbar">
            <h:form id="formArritmiaButtons">
                <p:toolbar>  
                    <p:toolbarGroup align="left">
                        <p:outputLabel value="#{msg.tlb_Arritmia}" style="margin-top: 5px; margin-left: 5px; "/>
                        <p:separator/>
                    </p:toolbarGroup>
                    <p:toolbarGroup align="right">
                        <p:commandButton value="#{msg.grn_botonAgregar}" styleClass="ui-button-custome"
                                         icon="ui-icon-plus"
                                         update=":formArritmiaAlta :formArritmiaConsulta :growl"
                                         actionListener="#{ArritmiaController.executeChangeToCreate}"/>
                        <p:commandButton value="#{msg.grn_botonConsultar}" styleClass="ui-button-custome"
                                         icon="ui-icon-folder-open"
                                         update=":formArritmiaAlta :formArritmiaConsulta :growl"
                                         actionListener="#{ArritmiaController.executeConsultarArritmia}"/>                      
                        <p:commandButton value="#{msg.grn_botonLimpiar}" styleClass="ui-button-custome"
                                         update=":formArritmiaAlta :formArritmiaConsulta"
                                         icon="ui-icon-clipboard"
                                         actionListener="#{ArritmiaController.executeLimpiarObejects}"/>
                    </p:toolbarGroup>
                </p:toolbar>
                <br/>
            </h:form>
        </ui:define>
        <ui:define name="body">
            <p:growl id="growl" globalOnly="true" showSummary="true" showDetail="true" autoUpdate="true" />
            <h:form id="formArritmiaAlta" prependId="false" >
                <h:panelGroup rendered="#{ArritmiaController.renderPanelAlta}">
                    <div class="row">
                        <div class="col-md-offset-2 col-md-8">
                            <div class="panel panel-primary">
                                <div class="panel-heading">#{msg.mng_arritmia_AddArritmia}</div>
                                <div class="panel-body">
                                    <center>
                                        <h:panelGrid columns="1">
                                            <h:outputText value="#{msg.obj_arritmia}:" />
                                            <p:inputText id="tipoArritmia" value="#{ArritmiaController.createArritmia.tipoArritmia}"
                                                         validatorMessage="#{msg.vld_valorNoPermitido}" requiredMessage="#{msg.vld_campoNecesario}" 
                                                         required="true">
                                                <f:validateRegex pattern="[A-Za-z ]+"/>
                                            </p:inputText>
                                            <p:message for="tipoArritmia"/>
                                        </h:panelGrid>
                                    </center>
                                </div>
                                <div class="panel-footer">
                                    <center>
                                        <p:commandButton value="#{msg.grn_botonAgregar}" styleClass="ui-button-custome"
                                                         update=":formArritmiaAlta :formArritmiaConsulta :growl"
                                                         actionListener="#{ArritmiaController.executeCrearArritmia}"/>
                                        <p:commandButton id="btnLimpiar" styleClass="ui-button-custome" value="#{msg.grn_botonLimpiar}"
                                                         actionListener="#{ArritmiaController.executeLimpiarObejects}">
                                            <p:ajax update=":formArritmiaAlta" resetValues="true" />  
                                        </p:commandButton>
                                    </center>
                                </div>
                            </div>
                        </div>
                    </div>
                </h:panelGroup>
            </h:form>

            <h:form id="formArritmiaConsulta" prependId="false" >
                <p:contextMenu for="dTableRetrieveArritmia">
                    <p:menuitem value="#{msg.grn_botonEliminar}" icon="ui-icon-trash"
                                onclick="PF('widgetDeleteArritmia').show()"/>
                    <p:menuitem value="#{msg.grn_botonActulizar}" icon="ui-icon-pencil"
                                onclick="PF('widgetUpdateArritmia').show()"
                                update=":formArritmiaActualizar:pGrUpdateArritmia"/>
                </p:contextMenu>        
                <div id="dataTableStyle">
                    <p:dataTable id="dTableRetrieveArritmia" 
                                 value="#{ArritmiaController.modelArritmia}"
                                 rendered="#{ArritmiaController.renderPanelConsulta}"
                                 emptyMessage="No Arritmia"
                                 var="varRetrieveArritmia"
                                 selectionMode="single" 
                                 rowKey="#{varRetrieveArritmia.idArritmia}"  
                                 selection="#{ArritmiaController.selectedArritmia}" 
                                 paginator="true" 
                                 rows="10"  
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15" 
                                 lazy="true">
                        <p:column headerText="#{msg.obj_arritmia}" sortBy="arritmia" filterBy="#{varRetrieveArritmia.tipoArritmia}">
                            <h:outputText value="#{varRetrieveArritmia.tipoArritmia}"/>
                        </p:column>
                    </p:dataTable>
                </div>                
            </h:form>

            <h:form id="formArritmiaActualizar" prependId="true">
                <p:dialog id="diUpdateArritmia" widgetVar="widgetUpdateArritmia" 
                          showEffect="clip" hideEffect="fold" modal="true">
                    <div class="container"  style="width: 500px !important; margin-top: 0px !important;">
                        <center>
                            <h:panelGrid id="pGrUpdateArritmia" >
                                <p:outputLabel value="#{msg.obj_arritmia}:"/>
                                <p:inputText id="inputNombre" label="#{msg.obj_arritmia}" styleClass="form-control"
                                             style="width: 200px !important"
                                             value="#{ArritmiaController.selectedArritmia.tipoArritmia}" 
                                             validatorMessage="#{msg.vld_valorNoPermitido}" requiredMessage="#{msg.vld_campoNecesario}" required="true">
                                    <f:validateRegex pattern="[A-Za-z ]+"/>
                                </p:inputText>
                            </h:panelGrid>
                        </center>
                    </div>
                    <f:facet name="footer" >
                        <center>
                            <p:commandButton id="btnModificar" value="#{msg.grn_botonModificar}"
                                             style="margin-left: 10px;"
                                             update=":formArritmiaConsulta" 
                                             onclick="PF('widgetUpdateArritmia').hide()"
                                             styleClass="ui-button-custome" icon="ui-icon-check"
                                             actionListener="#{ArritmiaController.executeActualizarArritmia}"/>
                        </center>
                    </f:facet>
                </p:dialog>
            </h:form>

            <h:form id="formArritmiaEliminar" prependId="false">
                <p:confirmDialog id="cDiDeleteArritmia" widgetVar="widgetDeleteArritmia" header="#{msg.grn_botonEliminar}" closable="true" hideEffect="explode">
                    <f:facet name="message">
                        <h:outputText value="#{msg.grn_eliminarRegistro}" />
                    </f:facet>
                    <p:commandButton value="#{msg.grn_botonSi}" actionListener="#{ArritmiaController.executeEliminarArritmia}" 
                                     style="margin-left: 10px;" 
                                     update=":formArritmiaConsulta"
                                     onclick="PF('widgetDeleteArritmia').hide()"
                                     styleClass="ui-button-custome" icon="ui-icon-check"/>  
                    <p:commandButton value="#{msg.grn_botonNo}" type="button" onclick="PF('widgetDeleteArritmia').hide()"
                                     styleClass="ui-confirmdialog-no" icon="ui-icon-close"/> 

                </p:confirmDialog>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

